Conversation
WoWaster
left a comment
There was a problem hiding this comment.
Попахивает нейронкой, но ладно
| size_t capacity; | ||
| }; | ||
|
|
||
| int reserve(struct Vector* vector, size_t new_capacity) |
There was a problem hiding this comment.
Вообще странный выбор кода возврата, если бывает bool.
|
|
||
| int reserve(struct Vector* vector, size_t new_capacity) | ||
| { | ||
| void** new_data; |
| if (!new_data) | ||
| return -1; |
There was a problem hiding this comment.
Коды возврата стоит описывать в хедере
|
|
||
| vector->data = NULL; | ||
| vector->size = 0; | ||
| vector->capacity = 0; |
There was a problem hiding this comment.
Ну, честно говоря, начальный capacity лучше делать не 0.
| return vector; | ||
| } | ||
|
|
||
| void deleteVector(struct Vector* vector) |
There was a problem hiding this comment.
Не очень понимаю, что пользователь должен делать со своими данными. Чистить сам? Это нужно было описать.
There was a problem hiding this comment.
Самая главная проблема --- нет описания стратегии владения. Я не понимаю, что должен делать пользователь, чтобы у него не текла память
| struct Vector* reliable; | ||
| size_t i; | ||
| size_t n; |
There was a problem hiding this comment.
Ой, а это зачем, ещё и не инициализированное?
| size_t n; | ||
| size_t i; | ||
| size_t count; | ||
| double sumSignal; | ||
| uint8_t maxSignal; | ||
| size_t maxId; | ||
| int hasMax; |
There was a problem hiding this comment.
Здесь такой же вопрос. Особенно много вопросов, зачем выносить i наверх
| sumSignal = 0.0; | ||
| maxSignal = 0; | ||
| maxId = 0; | ||
| hasMax = 0; |
| if (count == 0) { | ||
| printf("No reliable points to analyze.\n"); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Такое правда может случиться?
No description provided.